package com.yanqu.road.server.logic.activity.condition.springbanquet;

import com.yanqu.road.entity.activity.ActivityConditionInfo;
import com.yanqu.road.entity.activity.ActivityInfo;
import com.yanqu.road.entity.enums.eGamePlayerEventType;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.gameplayer.module.task.TaskModule;
import com.yanqu.road.server.logic.activity.BaseActivityData;
import com.yanqu.road.server.logic.activity.condition.BaseActivityCondition;
import com.yanqu.road.server.manger.activity.ActivityMgr;
import com.yanqu.road.utils.date.DateHelper;

import java.math.BigInteger;

/**
 * 累计vip经验
 */
public class SpringBanquetVipExpCondition extends BaseActivityCondition {

	public SpringBanquetVipExpCondition(ActivityInfo activityInfo, ActivityConditionInfo activityConditionInfo, BaseActivityData baseActivityData) {
		super(activityInfo, activityConditionInfo, baseActivityData);
	}

	@Override
	public void addTrigger(GamePlayer player) {
		player.getModule(TaskModule.class).getGameEvent().addListener(eGamePlayerEventType.SpringBanquetVip.getValue(), handle);
	}

	@Override
	public void removeTrigger(GamePlayer player) {
		player.getModule(TaskModule.class).getGameEvent().removeListener(eGamePlayerEventType.SpringBanquetVip.getValue(), handle);
	}

	public boolean isCompleted(GamePlayer player) {
		BigInteger param4 = activityConditionInfo.getParamList().get(3);
		return getValue().compareTo(param4) >= 0;
	}

	@Override
	protected void player_BoardLevelHandle(Object object) {
        long value = (long) object;
        setValue(getValue().add(BigInteger.valueOf(value)));
	}
}
